import 'package:flutter/material.dart';
import 'package:flutter_ext/home/daily_page.dart';
import 'package:flutter_ext/home/page/article_page.dart';
import 'package:flutter_ext/home/page/feed_page.dart';
//import 'package:flutter_gank/page/article_page.dart';
//import 'package:flutter_gank/page/daily_page.dart';
//import 'package:flutter_gank/page/feed_page.dart';
//import 'package:flutter_gank/page/search_page.dart';
//import 'package:flutter_gank/theme/theme.dart';

class HomePage extends StatefulWidget{

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return new HomePageState();
  }

}

class HomePageState extends State<HomePage> {
  int _currentIndex = 0;
  @override
  Widget build(BuildContext context) {

    return new Scaffold(
      body: _buildNetBody(),
      bottomNavigationBar: new BottomNavigationBar(
          currentIndex: _currentIndex,
          items: [
            new BottomNavigationBarItem(
                icon: new Icon(Icons.home),title: new Text("home")),
            new BottomNavigationBarItem(
                icon: new Icon(Icons.category),title: new Text("category")),
            new BottomNavigationBarItem(
                icon: new Icon(Icons.whatshot),title: new Text("whatshot")),
            new BottomNavigationBarItem(
                icon: new Icon(Icons.search),title: new Text("search"))
          ],
        type: BottomNavigationBarType.fixed,
        onTap: (int selected){
            setState(() {
              this._currentIndex = selected;
            });
        },
      ),
    );
  }


  Widget _buildNetBody() {
    final List<Widget> transitions = <Widget>[];

  transitions.add(new DailyPage());
  transitions.add(new FeedPage());
  transitions.add(new ArticlePage());
//  transitions.add(new SearchPage());

    return new IndexedStack(
      children: transitions,
      index: _currentIndex,
    );
  }
}